import PreviewItems from "@/components/JG-ImageView"; // 引用preview组件

const Preview = {};
// 注册
Preview.install = function(Vue) {
  const PreviewConstructor = Vue.extend(PreviewItems);
  const instance = new PreviewConstructor();
  instance.$mount(document.createElement("div"));
  document.body.appendChild(instance.$el);

  /**
   * 挂载在vue原型上
   * @param {Array} imgs 需要预览的图片数组
   */
  Vue.prototype.$openPreview = function(imgs = []) {
    instance.showPreview = true;
    instance.previewImages = imgs;
  };
};

export default Preview;